package com.zeng.sys.filemd.servicemodule.wrapperImpl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.zeng.nicecore.wrapper.AbstractWrapperBuilder;
import com.zeng.sys.filemd.servicemodule.entity.FileRecord;
import com.zeng.sys.filemd.servicemodule.vo.FileRecordVo;
import org.springframework.util.CollectionUtils;

public class FileRecordWrapper implements AbstractWrapperBuilder<FileRecordVo, FileRecord> {

    @Override
    public void wrapperHandle(QueryWrapper wrapper, FileRecordVo fileRecordVo) {
        like(wrapper, FileRecord.Fields.name, fileRecordVo.getName());
        eq(wrapper, FileRecord.Fields.fileServerCode, fileRecordVo.getFileServerCode());
        eq(wrapper, FileRecord.Fields.fileTypeCode, fileRecordVo.getFileTypeCode());
        wrapper.in(!CollectionUtils.isEmpty(fileRecordVo.getCodes()), "code", fileRecordVo.getCodes());
    }
}
